package com.rc.saas.tenant.service.member;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.rc.saas.tenant.mapper.member.MemberAccountRecordMapper;
import com.rc.saas.tenant.search.member.MemberAccountRecordSearch;
import com.rc.saas.tenant.vo.member.MemberAccountRecordPrintVo;
import com.rc.saas.tenant.vo.member.MemberAccountRecordResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MemberAccountRecordServiceImpl implements MemberAccountRecordService {
    @Autowired
    private MemberAccountRecordMapper memberAccountRecordMapper;

    @Override
    public MemberAccountRecordMapper getMapper() {
        return memberAccountRecordMapper;
    }

    @Override
    public PageInfo<MemberAccountRecordResultVo> searchByCondition(MemberAccountRecordSearch memberAccountRecordSearch) {
        PageHelper.startPage(memberAccountRecordSearch.getOffset(), memberAccountRecordSearch.getLimit());
        List<MemberAccountRecordResultVo> memberAccountRecords = memberAccountRecordMapper.searchByCondition(memberAccountRecordSearch);
        return new PageInfo<MemberAccountRecordResultVo>(memberAccountRecords);
    }

    @Override
    public PageInfo<MemberAccountRecordResultVo> listPageSubMemberAmountRecord(MemberAccountRecordSearch memberAccountRecordSearch) {
        PageHelper.startPage(memberAccountRecordSearch.getOffset(), memberAccountRecordSearch.getLimit());
        List<MemberAccountRecordResultVo> memberAccountRecords = memberAccountRecordMapper.listPageSubMemberAmountRecord(memberAccountRecordSearch);
        return new PageInfo<MemberAccountRecordResultVo>(memberAccountRecords);
    }

    @Override
    public List<MemberAccountRecordPrintVo> listSubMemberAmountRecord(MemberAccountRecordSearch memberAccountRecordSearch) {
        return memberAccountRecordMapper.listSubMemberAmountRecord(memberAccountRecordSearch);
    }
}
